package com.wxx.design.threadlocalsingleton;

/**
 * @author Jetwang
 * @version 1.0
 * @date 2022/4/14 19:43
 * ThreadLocalSingleton
 */
public class ThreadLocalSingleton {
    private static final ThreadLocal<ThreadLocalSingleton> THREAD_LOCAL_SINGLETON
            = new ThreadLocal<ThreadLocalSingleton>() {
        @Override
        protected ThreadLocalSingleton initialValue() {
            return new ThreadLocalSingleton();
        }
    };

    private ThreadLocalSingleton() {

    }

    public static ThreadLocalSingleton getInstance() {
        return THREAD_LOCAL_SINGLETON.get();
    }
}
